package com.xy.biz.ts.domain.bo;

import java.util.HashMap;
import java.util.Map;

public class TrainFlowConstants extends TrainBO {

    public final static String VARIABLE_ASSIGNEE_LIST = "assigneeList";
    public final static String VARIABLE_ASSIGNEE = "assignee";
    public final static String VARIABLE_HANDLE = "handle";

    public final static String PROCESS_NEW_FLOW = "newTrain";
    public final static String PROCESS_TRAINING_SUMMARY_PROGRESS = "trainingSummaryProgress";

    public final static int HANDLE_RESULT_FINISH_FLOW = 0;
    public final static int HANDLE_RESULT_ACCEPT = 1;
    public final static int HANDLE_RESULT_REJECT = 2;
    public final static int HANDLE_RESULT_END = 3;
    public final static int HANDLE_RESULT_CANCEL = 4;

    public final static String URGENT_NORMAL = "0";
    public final static String URGENT_URGENT = "1";

    public final static int TRAIN_CHECK_STATUS_UNCHECK = 0;
    public final static int TRAIN_CHECK_STATUS_CHECK = 1;
    public final static int TRAIN_CHECK_STATUS_START = 2;

    /**
     * 流程类型-普通培训
     */
    public final static String FLOW_TYPE_NEW = "train_common";
    /**
     * 流程类型-培训总结
     */
    public final static String FLOW_TYPE_SUM = "train_sum";

    /**
     * 状态-申请
     */
    public final static String PHASE_APPLY = "newApply";
    /**
     * 状态-主管领导审核
     */
    public final static String PHASE_ADMINAUDIT = "adminAudit";
    /**
     * 状态-人事行政部意见
     */
    public final static String PHASE_OPINION = "opinion";
    /**
     * 状态-审核1
     */
    public final static String PHASE_AUDIT1 = "audit1";
    /**
     * 状态-审核2
     */
    public final static String PHASE_AUDIT2 = "audit2";
    /**
     * 状态-审核3
     */
    public final static String PHASE_AUDIT3 = "audit3";
    /**
     * 状态-发行
     */
    public final static String PHASE_RELEASE = "release";
    /**
     * 状态-拒绝申请
     */
    public final static String PHASE_REJECT = "reject";
    /**
     * 状态-流程终止
     */
    public final static String PHASE_END = "end";

    /**
     * 状态-取消申请的申请
     */
    public final static String PHASE_CANCEL = "cancel";

    /**
     * 状态-拒绝申请
     */
    public final static String PHASE_REJECT_CANCEL = "reject_cancel";

    /**
     * 状态-同意"取消申请"申请
     */
    public final static String PHASE_AGREE_CANCEL = "agree_cancel";

    public final static Map<String, Map<String, String>> phaseMap = new HashMap<>();
    public final static Map<String, Integer> trainPhaseNumMap = new HashMap<>();

    static {
        Map<String, String> trainPhaseMap = new HashMap<>();
        trainPhaseMap.put(PHASE_APPLY, "新增申请");
        trainPhaseMap.put(PHASE_AUDIT1, "审核1");
        trainPhaseMap.put(PHASE_ADMINAUDIT, "主管领导审核");
        trainPhaseMap.put(PHASE_OPINION, "人事行政部意见");
        trainPhaseMap.put(PHASE_AUDIT2, "审核2");
        trainPhaseMap.put(PHASE_AUDIT3, "审核3");
        trainPhaseMap.put(PHASE_RELEASE, "新增发行");
        trainPhaseMap.put(PHASE_END, "结束");
        trainPhaseMap.put(PHASE_CANCEL, "取消申请");

        trainPhaseNumMap.put(PHASE_APPLY, 1);
        trainPhaseNumMap.put(PHASE_AUDIT1, 2);
        trainPhaseNumMap.put(PHASE_ADMINAUDIT, 2);
        trainPhaseNumMap.put(PHASE_OPINION, 3);
        trainPhaseNumMap.put(PHASE_AUDIT2, 3);
        trainPhaseNumMap.put(PHASE_AUDIT3, 4);
        trainPhaseNumMap.put(PHASE_RELEASE, 4);
        phaseMap.put(FLOW_TYPE_NEW, trainPhaseMap);

    }

    public final static String getPhaseName(String flowType, String phase) {
        Map<String, String> map = phaseMap.get(flowType);
        if(map != null) {
            return map.get(phase);
        }
        return null;
    }
    public final static Integer getPhaseNum(String phase) {
        return trainPhaseNumMap.get(phase);
    }

}
